import {
	http
} from "@/utils/request.js";

import api from "@/config/api.js";

/**
 * 发送验证码
 * @param  mobile
 */
export function sendMobile(mobile, type = 'LOGIN') {
	return http.request({
		url: `/api/sms/send`,
		method: "POST",
	});
}

/**
 * 短信登录
 * @param  mobile
 * @param  smsCode
 */
export function smsLogin(params, clientType) {
	return http.request({
		url: `/api/user/smsCheckIn`,
		method: "POST",
		data: params,
		header: {
			"content-type": "application/x-www-form-urlencoded",
			clientType: clientType,
		},
	});
}

// 登出
export function logout() {
	return http.request({
		url: '/api/user/logout',
		method: "POST",
		needToken: true,
	})
}

// 获取微信OpenID
export function getWechatOpenId(params) {
	return http.request({
		url: '/api/user/getWechatOpenId',
		method: "POST",
		data: params
	})
}